package com.imooc.netty.ch2;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * ip测试类
 *
 * @author lcy
 * @create 2018-09-08 09:20
 */
public class InetTest {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress address =InetAddress.getByName("www.baidu.com");
        System.out.println(address);
        System.out.println(address.getHostName());
        System.out.println(address.getAddress());
        System.out.println(address.getCanonicalHostName());
        System.out.println(address.getHostAddress());

        InetAddress address1 = InetAddress.getLocalHost();
        System.out.println(address1);
    }
}
